{* aux page managment *}
{literal}
<script type="text/javascript" src="/js/tinymce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
    	mode : "textareas",
        width : 920,
        height : 400, 
    	elements : "elm1",
    	theme : "advanced",
    	skin : "o2k7",
        skin_variant : "silver",
    	language: "ru",
        relative_urls : false,
    	editor_selector : "mceEditor",
    	plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",

        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",

    	theme_advanced_toolbar_location : "top",
    	theme_advanced_toolbar_align : "left",
    	theme_advanced_statusbar_location : "bottom",
    	theme_advanced_resizing : false,
    	content_css : "class.css"	
    }); 
</script> 
{/literal}
{if $edit || $add_new}

{if $edit}
<form action='admin.php?dpt=conf&sub=aux_pages&edit={$aux_page.aux_page_ID}' method=post>
{else}
<form action='admin.php?dpt=conf&sub=aux_pages&add_new=yes' method=post>
{/if}

	<p>
		<a href="admin.php?dpt=conf&sub=aux_pages">
			{$smarty.const.ADMIN_GOBACK_TO_AUX_PAGES}
		</a>
	</p>

	<table border="0" cellspacing="1" cellpadding="3">
		<tr> 
			<td align="right" valign="top">{$smarty.const.AUX_PAGE_NAME}:</td>
			<td><input name="aux_page_name" type="text" value='{$aux_page.aux_page_name}' size="50"></td>
		</tr>
		<tr> 
			<td align="right" valign="top">HTML:</td>
			<td>
			<p> 
				<input type="checkbox" name="aux_page_text_type" value="1"
				{if $aux_page.aux_page_text_type == 1}
					checked
				{/if}
				>
				<br>
				</p>
			</td>
		</tr>

		<tr>
			<td align="right" valign="top">{$smarty.const.AUX_PAGE_TEXT}:</td>
			<td>
				<textarea class="mceEditor" name="aux_page_text" cols="60" rows="15">{$aux_page.aux_page_text}</textarea>
			</td>
		</tr>

		<tr>
			<td align='right' valign='top'>{$smarty.const.ADMIN_META_KEYWORDS}</td>
			<td>
				<input type=text name='meta_keywords' value='{$aux_page.meta_keywords}'>
			</td>
		</tr>

		<tr>
			<td align='right' valign='top'>{$smarty.const.ADMIN_META_DESCRIPTION}</td>
			<td>
				<textarea name="meta_description" cols="25" rows="4">{$aux_page.meta_description}</textarea>
			</td>
		</tr>

		<tr>
			<td align="right" valign="top">&nbsp;</td>
			<td>
				<input type=submit value='{$smarty.const.SAVE_BUTTON}' name='save'>
			</td>
		</tr>

	</table>

</form>

{else}

<p>{$smarty.const.AUX_PAGES_DESCRIPTION}
<p>
<table cellspacing=1 cellpadding=5 bgcolor=#bedddb border=0>
	<tr bgcolor=#56afd6 colspan=5> 
		<td align=middle colspan=5><b>{$smarty.const.ADMIN_AUX_PAGES}</b></td>
	</tr>
	<tr bgcolor=#bedddb> 
		<td align=middle>{$smarty.const.AUX_PAGE_NAME}</td>
		<td align=middle>{$smarty.const.AUX_PAGE_TEXT_TYPE}</td>
		<td align=middle>{$smarty.const.AUX_PAGE_REF}</td>
		<td align=middle>{$smarty.const.AUX_PAGE_EDIT}</td>
		<td align=middle>&nbsp;</td>
	</tr>

	{section name=i loop=$aux_pages}
		<tr bgcolor=white> 
			<td>{$aux_pages[i].aux_page_name}</td>
			<td>
				{if $aux_pages[i].aux_page_text_type == 0}
					TEXT
				{else}
					HTML
				{/if}
			</td>
			<td>

				<script language='JavaScript'>

				function open_full_window(link) //opens new window
				{literal}
				{
				{/literal}
					var win = "menubar=no,location=no,resizable=yes,scrollbars=yes";
					auxPageWin = window.open(link,'auxPageWin',win);
				{literal}
				}
				{/literal}

				</script>

				</script>

				&lt;a href="index.php?show_aux_page={$aux_pages[i].aux_page_ID}"&gt;{$aux_pages[i].aux_page_name}&lt;/a&gt;
				<br>
				<a href='JavaScript:open_full_window("index.php?show_aux_page={$aux_pages[i].aux_page_ID}")'>
					{$smarty.const.ADMIN_SHOW_AUX_PAGE}
				</a>
			</td>
			<td>
				<a href='admin.php?dpt=conf&sub=aux_pages&edit={$aux_pages[i].aux_page_ID}'>
					{$smarty.const.AUX_PAGE_EDIT}...
				</a>
			</td>
			<td>
				<a 
					href="javascript:confirmDelete({$aux_pages[i].aux_page_ID},'{$smarty.const.QUESTION_DELETE_CONFIRMATION}','admin.php?dpt=conf&sub=aux_pages&delete=');">
						<img 
							alt='{$smarty.const.DELETE_BUTTON}' 
							src="./images/remove.jpg" 
							border=0>
				</a>
			</td>
		</tr>
	{/section}

	<tr> 
		<td align=middle colspan=5>
			<a href="admin.php?dpt=conf&sub=aux_pages&add_new=yes">
				{$smarty.const.AUX_PAGE_ADD_NEW}
			</a>
		</td>
	</tr>

</table>

{/if}